<!DOCTYPE html>
<html>
    <head>
        <!-- 页面meta -->
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>传智健康</title>
        <meta name="description" content="传智健康">
        <meta name="keywords" content="传智健康">
        <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
        <!-- 引入样式 -->
        <link rel="stylesheet" href="../css/style.css">
        <script src="../plugins/echarts/echarts.js"></script>
        <link rel="stylesheet" href="../plugins/elementui/index(1).css">
        <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
        <!-- 引入组件库 -->
        <script type="text/javascript" src="../js/jquery.min.js"></script>
        <script src="../js/vue.js"></script>
        <script src="../plugins/elementui/index.js"></script>
        <script src="../js/axios-0.18.0.js"></script>
    </head>
    <style>
        .block {
            margin-left: 20px;
            margin-top: 10px;
        }
    </style>
    <body class="hold-transition">
        <div id="app">
            <div class="content-header">
                <h1>统计分析<small>会员数量</small></h1>
                <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
                    <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                    <el-breadcrumb-item>统计分析</el-breadcrumb-item>
                    <el-breadcrumb-item>会员数量</el-breadcrumb-item>
                </el-breadcrumb>
            </div>
                <div class="block">
                    <el-date-picker
                            v-model="queryDate"
                            type="daterange"
                            range-separator="至"
                            start-placeholder="开始日期"
                            end-placeholder="结束日期"
                            format="yyyy 年 MM 月 dd 日"
                            value-format="yyyy-MM-dd"
                    >
                    </el-date-picker>
                    <el-button  @click="findOrder()">查询</el-button>
                </div>
            <div class="app-container">
                <div class="box">
                    <div id="chart12" style="height:600px;">

                    </div>
                </div>
            </div>
        </div>
    </body>
    <!-- 引入组件库 -->

    <script type="text/javascript">
        var myChart1 = echarts.init(document.getElementById('chart12'));
        myChart1.setOption({
            title: {
                text: '对数轴示例',
                left: 'center'
            },
            tooltip: {
                trigger: 'item',
                formatter: '{a} <br/>{b} : {c}'
            },
            legend: {
                left: 'left',
                data: ['未到诊', '已到诊']
            },
            xAxis: {
                type: 'category',
                name: 'x',
                splitLine: {show: false},
                data:[1,2,3,4,5]
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            yAxis: {
                type: 'log',
                name: 'y',
                minorTick: {
                    show: true
                },
                minorSplitLine: {
                    show: true
                }
            },
            series: [
                {
                    name: '未到诊',
                    type: 'line',
                    data: [1,2,3,4,5]
                },
                {
                    name: '已到诊',
                    type: 'line',
                    data: [3,2,3,4,5]
                }

            ]
        });
    </script>
    <script>
        var vue = new Vue({
            el: '#app',
            data: {
                queryDate: [new Date(2019, 10, 10), new Date(2020, 10, 11)],
                return:{
                    pickerOptions: {
                        shortcuts: [{
                            text: '最近一周',
                            onClick(picker) {
                                const end = new Date();
                                const start = new Date();
                                start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                                picker.$emit('pick', [start, end]);
                            }
                        }, {
                            text: '最近一个月',
                            onClick(picker) {
                                const end = new Date();
                                const start = new Date();
                                start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                                picker.$emit('pick', [start, end]);
                            }
                        }, {
                            text: '最近三个月',
                            onClick(picker) {
                                const end = new Date();
                                const start = new Date();
                                start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
                                picker.$emit('pick', [start, end]);
                            }
                        }]
                    },
                }
            },
            mounted(){
                var myChart1 = echarts.init(document.getElementById('chart1'));
            },
            created(){
                this.findOrder()
            },
            methods:{
                findOrder(){
                    // 基于准备好的dom，初始化echarts实例

                    axios.post("/order/findByDate.do?",this.queryDate).then((res)=>{
                        myChart1.setOption({
                            title: {
                                text: '对数轴示例',
                                left: 'center'
                            },
                            tooltip: {
                                trigger: 'item',
                                formatter: '{a} <br/>{b} : {c}'
                            },
                            legend: {
                                left: 'left',
                                data: ['未到诊', '已到诊']
                            },
                            xAxis: {
                                type: 'category',
                                name: 'x',
                                splitLine: {show: false},
                                data:res.data.data.allDate
                            },
                            grid: {
                                left: '3%',
                                right: '4%',
                                bottom: '3%',
                                containLabel: true
                            },
                            yAxis: {
                                type: 'log',
                                name: 'y',
                                minorTick: {
                                    show: true
                                },
                                minorSplitLine: {
                                    show: true
                                }
                            },
                            series: [
                                {
                                    name: '未到诊',
                                    type: 'line',
                                    data: res.data.data.perOrder
                                },
                                {
                                    name: '已到诊',
                                    type: 'line',
                                    data: res.data.data.perCome
                                }

                            ]
                        });
                    });

                },
            }


            });
    </script>
</html>
